package com.hao.imserver.model;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class Message {
    private String from;
    
    private String to;
    
    private String content;
    
    private Long timeStamp;

    
    public Message() {
	super();
    }

    public Message(String from, String to, String content, Long timeStamp) {
	super();
	this.from = from;
	this.to = to;
	this.content = content;
	this.timeStamp = timeStamp;
    }

    public String getFrom() {
        return from;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    public String getTo() {
        return to;
    }

    public void setTo(String to) {
        this.to = to;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Long getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Long timeStamp) {
        this.timeStamp = timeStamp;
    }

    @Override
    public String toString() {
	ObjectMapper om = new ObjectMapper();
	try {
	    return om.writeValueAsString(this);
	} catch (JsonProcessingException e) {
	    e.printStackTrace();
	}
	return "{}";
    }
    
    
}
